//
//  HLWaybillDetailVC.m
//  zhuanxian
//
//  Created by zhaoliang chen on 2017/11/18.
//  Copyright © 2017年 huiling. All rights reserved.
//

#import "HLWaybillDetailVC.h"
#import "HLUnderlineView.h"
#import "ZLImageTextButton.h"
#import "M13Checkbox.h"
#import "HLContactListVC.h"
#import "ActionSheetPicker.h"
#import "HLOtherPayView.h"
#import "HLTransportTypeObject.h"
#import "HLPaymentWayObject.h"
#import "HLServiceTypeObject.h"
#import "HLPackingWayObject.h"
#import "HLAdditionalObject.h"

@interface HLWaybillDetailVC ()
<HLOtherPayViewDelegate,UITextFieldDelegate>

@property(nonatomic,strong)HLWaybillDetailObject* waybillObject;
@property(nonatomic,copy)NSString* waybillId;
@property(nonatomic,assign)NSInteger type;

@property(nonatomic,strong)ZLImageTextButton* btnRecvStation;
@property(nonatomic,strong)UILabel* labelRecvStation;
@property(nonatomic,strong)UITextField* textFieldRecvStation;
@property(nonatomic,strong)UITextField* textFieldWaybillNumber;
@property(nonatomic,strong)UITextField* textFieldRecvName;
@property(nonatomic,strong)UITextField* textFieldRecvPhone;
@property(nonatomic,strong)UITextField* textFieldRecvAddress;
@property(nonatomic,strong)UITextField* textFieldSendName;
@property(nonatomic,strong)UITextField* textFieldSendPhone;
@property(nonatomic,strong)UITextField* textFieldCargoName;
@property(nonatomic,strong)UITextField* textFieldCargoCount;
@property(nonatomic,strong)ZLImageTextButton* btnPack;
@property(nonatomic,strong)ZLImageTextButton* btnDeliverType;       //提货方式
@property(nonatomic,strong)ZLImageTextButton* btnTransportType;     //运输方式
@property(nonatomic,strong)UITextField* textFieldWeight;
@property(nonatomic,strong)UITextField* textFieldVolume;
@property(nonatomic,strong)UITextField* textFieldPayment;           //运费
@property(nonatomic,strong)ZLImageTextButton* btnPayType;           //付款方式
@property(nonatomic,strong)UITextField* textFieldPayOther;          //其他
@property(nonatomic,strong)UITextField* textFieldPayTotal;          //合计
@property(nonatomic,strong)UITextField* textFieldCollection;        //
@property(nonatomic,strong)UITextField* textFieldKickback;          //回扣
@property(nonatomic,strong)HLUnderlineView* viewValue;              //有保价
@property(nonatomic,strong)HLUnderlineView* viewNoValue;            //无保价
@property(nonatomic,strong)M13Checkbox* btnInsure;                  //是否保价
@property(nonatomic,strong)UITextField* textFieldFreightMultiple;   //赔偿运费倍数
@property(nonatomic,strong)UITextField* textFieldInsuredCost;       //保价费用
@property(nonatomic,strong)UITextField* textFieldInsuredValue;      //保价金额
@property(nonatomic,strong)UITextField* textFieldSubjoin;           //附加条约
@property(nonatomic,strong)UIButton* btnMore;
@property(nonatomic,strong)M13Checkbox* btnNotificeReceiver;
@property(nonatomic,strong)M13Checkbox* btnNotificeSender;

@end

@implementation HLWaybillDetailVC

#define rowHeight   60

- (instancetype)init {
    self = [super init];
    if (self) {
        self.waybillObject = nil;
    }
    return self;
}

- (instancetype)initWithAddWaybill:(HLWebsiteObject*)model {
    self = [self init];
    if (self) {
        self.waybillObject = [[HLWaybillDetailObject alloc]init];
        self.waybillObject.destinationWebsite = model.websiteName;
        self.waybillObject.destinationWebsiteId = model.websiteId;
        self.type = 1;
    }
    return self;
}

- (instancetype)initWithWaybillDetail:(NSString*)waybillId {
    self = [self init];
    if (self) {
        self.waybillId = waybillId;
        self.type = 2;
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self setNavigationTitle:@"运单详情" Color:[UIColor whiteColor]];
    if (self.type == 2) {
        [self addRightNavigationBarButtonImage:nil Title:@"作废" Target:self Action:@selector(onClickCancellation)];
    }
    
    UIView* bottomView = [UIView new];
    [self.view addSubview:bottomView];
    [bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.left.right.mas_equalTo(self.view);
        make.height.mas_equalTo(44);
    }];
    
    UIButton* btnPrint = [UIButton buttonWithType:UIButtonTypeCustom];
    [btnPrint setTitle:@"打印" forState:UIControlStateNormal];
    btnPrint.tag = 0;
    [btnPrint addTarget:self action:@selector(onClickButton:) forControlEvents:UIControlEventTouchUpInside];
    btnPrint.backgroundColor = UIColorFromRGB(0x243048);
    [bottomView addSubview:btnPrint];
    [btnPrint mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.bottom.mas_equalTo(bottomView);
        make.width.mas_equalTo(bottomView.mas_width).multipliedBy(2.0/3);
    }];
    
    UIButton* btnSave = [UIButton buttonWithType:UIButtonTypeCustom];
    [btnSave setTitle:@"保存" forState:UIControlStateNormal];
    btnSave.tag = 1;
    [btnSave addTarget:self action:@selector(onClickButton:) forControlEvents:UIControlEventTouchUpInside];
    btnSave.backgroundColor = MainColor;
    [bottomView addSubview:btnSave];
    [btnSave mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.top.bottom.mas_equalTo(bottomView);
        make.width.mas_equalTo(bottomView.mas_width).multipliedBy(1.0/3);
    }];
    
    UIScrollView* scrollView = [UIScrollView new];
    [self.view addSubview:scrollView];
    [scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.mas_equalTo(self.view);
        make.bottom.mas_equalTo(bottomView.mas_top);
    }];
    
    UIView* contentView = [UIView new];
    contentView.backgroundColor = self.view.backgroundColor;
    [scrollView addSubview:contentView];
    [contentView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(scrollView);
        make.width.mas_equalTo(scrollView);
    }];
    
    HLUnderlineView* viewRecvStation = [self createUnderlineView];
    [contentView addSubview:viewRecvStation];
    [viewRecvStation mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.width.top.mas_equalTo(contentView);
        make.height.mas_equalTo(rowHeight);
    }];
    
    [viewRecvStation addSubview:self.btnRecvStation];
    [self.btnRecvStation mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(viewRecvStation);
        make.left.mas_equalTo(5);
        make.width.mas_equalTo(90);
    }];
    
    [viewRecvStation addSubview:self.labelRecvStation];
    [self.labelRecvStation mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.btnRecvStation.mas_right).offset(5);
        make.centerY.mas_equalTo(self.btnRecvStation);
        make.right.mas_equalTo(viewRecvStation.mas_centerX);
    }];
    
    UILabel* labelRecv = [UILabel new];
    labelRecv.text = @"到站";
    labelRecv.font = [UIFont systemFontOfSize:15];
    [viewRecvStation addSubview:labelRecv];
    [labelRecv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(viewRecvStation.mas_centerX);
        make.centerY.mas_equalTo(self.btnRecvStation);
    }];
    
    [viewRecvStation addSubview:self.textFieldRecvStation];
    [self.textFieldRecvStation mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(labelRecv.mas_right).offset(3);
        make.right.mas_equalTo(viewRecvStation);
        make.centerY.mas_equalTo(self.btnRecvStation);
    }];
    
    HLUnderlineView* view2 = [self createUnderlineView];
    [contentView addSubview:view2];
    [view2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(contentView);
        make.top.mas_equalTo(viewRecvStation.mas_bottom);
        make.height.mas_equalTo(rowHeight);
    }];
    
    UILabel* label2 = [UILabel new];
    label2.text = @"运单号";
    [view2 addSubview:label2];
    [label2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(view2);
        make.left.mas_equalTo(5);
    }];
    
    [view2 addSubview:self.textFieldWaybillNumber];
    [self.textFieldWaybillNumber mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(label2.mas_right).offset(5);
        make.centerY.mas_equalTo(label2);
        make.height.right.mas_equalTo(view2);
    }];
    
    UILabel* label3 = [UILabel new];
    label3.text = @"收发货人";
    label3.font = [UIFont systemFontOfSize:14];
    [contentView addSubview:label3];
    [label3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(35);
        make.left.mas_equalTo(5);
        make.top.mas_equalTo(view2.mas_bottom);
    }];
    
    //收货人角标
    HLUnderlineView* view3 = [self createUnderlineView];
    view3.backgroundColor = XMColor(240, 240, 240);
    [contentView addSubview:view3];
    [view3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(contentView);
        make.height.mas_equalTo(2*rowHeight);
        make.width.mas_equalTo(100);
        make.top.mas_equalTo(label3.mas_bottom);
    }];
    
    UIImageView* imgMark1 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"hl_bill_recvmark"]];
    [view3 addSubview:imgMark1];
    [imgMark1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.top.mas_equalTo(view3);
        make.size.mas_equalTo(25);
    }];
    
    ZLImageTextButton* btn1 = [ZLImageTextButton buttonWithType:UIButtonTypeCustom];
    [btn1 setImage:[UIImage imageNamed:@"hl_bill_recvheader"] forState:UIControlStateNormal];
    [btn1 setTitle:@"选择" forState:UIControlStateNormal];
    btn1.tag = 1000;
    [btn1 addTarget:self action:@selector(chooseContact:) forControlEvents:UIControlEventTouchUpInside];
    btn1.zlButtonType = ZLImageTopTextBottom;
    [view3 addSubview:btn1];
    [btn1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.mas_equalTo(view3);
        make.size.mas_equalTo(CGSizeMake(50, 70));
    }];
    
    //收货人名字
    HLUnderlineView* view4 = [self createUnderlineView];
    [contentView addSubview:view4];
    [view4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(view3.mas_left);
        make.height.mas_equalTo(rowHeight);
        make.left.mas_equalTo(contentView);
        make.top.mas_equalTo(view3);
    }];
    
    UIImageView* imgV1 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"hl_bill_recvname"]];
    [view4 addSubview:imgV1];
    [imgV1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(view4);
        make.left.mas_equalTo(5);
        make.size.mas_equalTo(35);
    }];
    
    [view4 addSubview:self.textFieldRecvName];
    [self.textFieldRecvName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(imgV1.mas_right).offset(10);
        make.height.centerY.mas_equalTo(view4);
        make.right.mas_equalTo(-5);
    }];
    
    //收货人电话
    HLUnderlineView* view5 = [self createUnderlineView];
    [contentView addSubview:view5];
    [view5 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(view3.mas_left);
        make.height.mas_equalTo(rowHeight);
        make.left.mas_equalTo(contentView);
        make.top.mas_equalTo(view4.mas_bottom);
    }];
    
    UIImageView* imgV2 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"hl_bill_recvphone"]];
    [view5 addSubview:imgV2];
    [imgV2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(view5);
        make.left.mas_equalTo(5);
        make.size.mas_equalTo(35);
    }];
    
    [view5 addSubview:self.textFieldRecvPhone];
    [self.textFieldRecvPhone mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(imgV2.mas_right).offset(10);
        make.height.centerY.mas_equalTo(view5);
        make.right.mas_equalTo(-5);
    }];
    
    //收货人地址
    HLUnderlineView* view6 = [self createUnderlineView];
    [contentView addSubview:view6];
    [view6 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(rowHeight);
        make.left.right.mas_equalTo(contentView);
        make.top.mas_equalTo(view5.mas_bottom);
    }];
    
    UIImageView* imgV3 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"hl_bill_recvaddress"]];
    [view6 addSubview:imgV3];
    [imgV3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(view6);
        make.left.mas_equalTo(5);
        make.size.mas_equalTo(35);
    }];
    
    [view6 addSubview:self.textFieldRecvAddress];
    [self.textFieldRecvAddress mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(imgV3.mas_right).offset(10);
        make.height.centerY.mas_equalTo(view6);
        make.right.mas_equalTo(-5);
    }];
    
    //发货人角标
    HLUnderlineView* view7 = [self createUnderlineView];
    view7.backgroundColor = XMColor(240, 240, 240);
    [contentView addSubview:view7];
    [view7 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(contentView);
        make.height.mas_equalTo(2*rowHeight);
        make.width.mas_equalTo(100);
        make.top.mas_equalTo(view6.mas_bottom).offset(10);
    }];
    
    UIImageView* imgMark2 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"hl_bill_sendmark"]];
    [view7 addSubview:imgMark2];
    [imgMark2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.top.mas_equalTo(view7);
        make.size.mas_equalTo(25);
    }];
    
    ZLImageTextButton* btn2 = [ZLImageTextButton buttonWithType:UIButtonTypeCustom];
    [btn2 setImage:[UIImage imageNamed:@"hl_bill_sendheader"] forState:UIControlStateNormal];
    [btn2 setTitle:@"选择" forState:UIControlStateNormal];
    btn2.tag = 1001;
    [btn2 addTarget:self action:@selector(chooseContact:) forControlEvents:UIControlEventTouchUpInside];
    btn2.zlButtonType = ZLImageTopTextBottom;
    [view7 addSubview:btn2];
    [btn2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.mas_equalTo(view7);
        make.size.mas_equalTo(CGSizeMake(50, 70));
    }];
    
    //发货人名字
    HLUnderlineView* view8 = [self createUnderlineView];
    [contentView addSubview:view8];
    [view8 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(view7.mas_left);
        make.height.mas_equalTo(rowHeight);
        make.left.mas_equalTo(contentView);
        make.top.mas_equalTo(view7);
    }];
    
    UIImageView* imgV4 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"hl_bill_sendname"]];
    [view8 addSubview:imgV4];
    [imgV4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(view8);
        make.left.mas_equalTo(5);
        make.size.mas_equalTo(35);
    }];
    
    [view8 addSubview:self.textFieldSendName];
    [self.textFieldSendName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(imgV3.mas_right).offset(10);
        make.height.centerY.mas_equalTo(view8);
        make.right.mas_equalTo(-5);
    }];
    
    //发货人电话
    HLUnderlineView* view9 = [self createUnderlineView];
    [contentView addSubview:view9];
    [view9 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(view7.mas_left);
        make.height.mas_equalTo(rowHeight);
        make.left.mas_equalTo(contentView);
        make.top.mas_equalTo(view8.mas_bottom);
    }];
    
    UIImageView* imgV5 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"hl_bill_recvphone"]];
    [view9 addSubview:imgV5];
    [imgV5 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(view9);
        make.left.mas_equalTo(5);
        make.size.mas_equalTo(35);
    }];
    
    [view9 addSubview:self.textFieldSendPhone];
    [self.textFieldSendPhone mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(imgV5.mas_right).offset(10);
        make.height.centerY.mas_equalTo(view9);
        make.right.mas_equalTo(-5);
    }];
    
    UILabel* label4 = [UILabel new];
    label4.text = @"货物与服务";
    label4.font = [UIFont systemFontOfSize:14];
    [contentView addSubview:label4];
    [label4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(35);
        make.left.mas_equalTo(5);
        make.top.mas_equalTo(view9.mas_bottom);
    }];
    
    //货物名称
    HLUnderlineView* viewCargoName = [self createUnderlineView];
    [contentView addSubview:viewCargoName];
    [viewCargoName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(label4.mas_bottom);
        make.height.mas_equalTo(rowHeight);
        make.left.right.mas_equalTo(contentView);
    }];
    
    UILabel* labelCargoName = [UILabel new];
    labelCargoName.text = @"货名:";
    [viewCargoName addSubview:labelCargoName];
    [labelCargoName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.centerY.mas_equalTo(viewCargoName);
        make.width.mas_equalTo(40);
    }];
    
    [viewCargoName addSubview:self.textFieldCargoName];
    [self.textFieldCargoName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.centerY.mas_equalTo(viewCargoName);
        make.right.mas_equalTo(-5);
        make.left.mas_equalTo(labelCargoName.mas_right).offset(10);
    }];
    
    //件数和包装
    HLUnderlineView* viewCargoCount = [self createUnderlineView];
    [contentView addSubview:viewCargoCount];
    [viewCargoCount mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(viewCargoName.mas_bottom);
        make.height.mas_equalTo(rowHeight);
        make.left.right.mas_equalTo(contentView);
    }];
    
    UILabel* labelCargoCount = [UILabel new];
    labelCargoCount.text = @"件数*";
    [viewCargoCount addSubview:labelCargoCount];
    [labelCargoCount mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.centerY.mas_equalTo(viewCargoCount);
        make.width.mas_equalTo(60);
    }];
    
    [viewCargoCount addSubview:self.textFieldCargoCount];
    [self.textFieldCargoCount mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.centerY.mas_equalTo(viewCargoCount);
        make.right.mas_equalTo(viewCargoCount.mas_centerX).offset(-5);
        make.left.mas_equalTo(labelCargoCount.mas_right).offset(5);
    }];
    
    UILabel* labelPack = [UILabel new];
    labelPack.text = @"包装*";
    [viewCargoCount addSubview:labelPack];
    [labelPack mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(viewCargoCount.mas_centerX).offset(5);
        make.centerY.mas_equalTo(viewCargoCount);
        make.width.mas_equalTo(60);
    }];
    
    [viewCargoCount addSubview:self.btnPack];
    [self.btnPack mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.centerY.mas_equalTo(viewCargoCount);
        make.right.mas_equalTo(-5);
        make.left.mas_equalTo(labelPack.mas_right).offset(5);
    }];
    
    //送货类型和运输类型
    HLUnderlineView* viewDeliverType = [self createUnderlineView];
    [contentView addSubview:viewDeliverType];
    [viewDeliverType mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(viewCargoCount.mas_bottom);
        make.height.mas_equalTo(rowHeight);
        make.left.right.mas_equalTo(contentView);
    }];
    
    UILabel* labelDeliverType = [UILabel new];
    labelDeliverType.text = @"送货类型*";
    [viewDeliverType addSubview:labelDeliverType];
    [labelDeliverType mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.centerY.mas_equalTo(viewDeliverType);
        make.width.mas_equalTo(80);
    }];
    
    [viewDeliverType addSubview:self.btnDeliverType];
    [self.btnDeliverType mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.centerY.mas_equalTo(viewDeliverType);
        make.right.mas_equalTo(viewDeliverType.mas_centerX).offset(-5);
        make.left.mas_equalTo(labelDeliverType.mas_right).offset(5);
    }];
    
    UILabel* labelTransportType = [UILabel new];
    labelTransportType.text = @"运输类型*";
    [viewDeliverType addSubview:labelTransportType];
    [labelTransportType mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(viewDeliverType.mas_centerX).offset(5);
        make.centerY.mas_equalTo(viewDeliverType);
        make.width.mas_equalTo(80);
    }];
    
    [viewDeliverType addSubview:self.btnTransportType];
    [self.btnTransportType mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.centerY.mas_equalTo(viewDeliverType);
        make.right.mas_equalTo(-5);
        make.left.mas_equalTo(labelTransportType.mas_right).offset(5);
    }];
    
    //重量和体积
    HLUnderlineView* viewWeightAndVolumn = [self createUnderlineView];
    [contentView addSubview:viewWeightAndVolumn];
    [viewWeightAndVolumn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(viewDeliverType.mas_bottom);
        make.height.mas_equalTo(rowHeight);
        make.left.right.mas_equalTo(contentView);
    }];
    
    UILabel* labelWeight = [UILabel new];
    labelWeight.text = @"重量";
    [viewWeightAndVolumn addSubview:labelWeight];
    [labelWeight mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.centerY.mas_equalTo(viewWeightAndVolumn);
        make.width.mas_equalTo(40);
    }];
    
    [viewWeightAndVolumn addSubview:self.textFieldWeight];
    [self.textFieldWeight mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.centerY.mas_equalTo(viewWeightAndVolumn);
        make.right.mas_equalTo(viewWeightAndVolumn.mas_centerX).offset(-5);
        make.left.mas_equalTo(labelWeight.mas_right).offset(5);
    }];
    
    UILabel* labelVolumn = [UILabel new];
    labelVolumn.text = @"体积";
    [viewWeightAndVolumn addSubview:labelVolumn];
    [labelVolumn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(viewWeightAndVolumn.mas_centerX).offset(5);
        make.centerY.mas_equalTo(viewWeightAndVolumn);
        make.width.mas_equalTo(40);
    }];
    
    [viewWeightAndVolumn addSubview:self.textFieldVolume];
    [self.textFieldVolume mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.centerY.mas_equalTo(viewWeightAndVolumn);
        make.right.mas_equalTo(-5);
        make.left.mas_equalTo(labelVolumn.mas_right).offset(5);
    }];
    
    UILabel* label5 = [UILabel new];
    label5.text = @"费用";
    label5.font = [UIFont systemFontOfSize:14];
    [contentView addSubview:label5];
    [label5 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(35);
        make.left.mas_equalTo(5);
        make.top.mas_equalTo(viewWeightAndVolumn.mas_bottom);
    }];
    
    //运费和付款方式
    HLUnderlineView* viewPayment = [self createUnderlineView];
    [contentView addSubview:viewPayment];
    [viewPayment mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(label5.mas_bottom);
        make.height.mas_equalTo(rowHeight);
        make.left.right.mas_equalTo(contentView);
    }];
    
    UILabel* labelPayment = [UILabel new];
    labelPayment.text = @"运费*";
    [viewPayment addSubview:labelPayment];
    [labelPayment mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.centerY.mas_equalTo(viewPayment);
        make.width.mas_equalTo(50);
    }];
    
    [viewPayment addSubview:self.textFieldPayment];
    [self.textFieldPayment mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.centerY.mas_equalTo(viewPayment);
        make.right.mas_equalTo(viewPayment.mas_centerX).offset(-5);
        make.left.mas_equalTo(labelPayment.mas_right).offset(5);
    }];
    
    UILabel* labelPayType = [UILabel new];
    labelPayType.text = @"付款";
    [viewPayment addSubview:labelPayType];
    [labelPayType mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(viewPayment.mas_centerX).offset(5);
        make.centerY.mas_equalTo(viewPayment);
        make.width.mas_equalTo(40);
    }];
    
    [viewPayment addSubview:self.btnPayType];
    [self.btnPayType mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.centerY.mas_equalTo(viewPayment);
        make.right.mas_equalTo(-5);
        make.left.mas_equalTo(labelPayType.mas_right).offset(5);
    }];
    
    //其他费用
    HLUnderlineView* viewPayother = [self createUnderlineView];
    [contentView addSubview:viewPayother];
    [viewPayother mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(viewPayment.mas_bottom);
        make.height.mas_equalTo(rowHeight);
        make.left.right.mas_equalTo(contentView);
    }];
    
    UILabel* labelPayother = [UILabel new];
    labelPayother.text = @"其他";
    [viewPayother addSubview:labelPayother];
    [labelPayother mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.centerY.mas_equalTo(viewPayother);
        make.width.mas_equalTo(40);
    }];
    
    UIButton* btnPayother = [UIButton buttonWithType:UIButtonTypeCustom];
    btnPayother.layer.borderColor = MainColor.CGColor;
    btnPayother.layer.borderWidth = 0.6;
    [btnPayother setTitle:@"费用明细" forState:UIControlStateNormal];
    [btnPayother addTarget:self action:@selector(onOtherPay) forControlEvents:UIControlEventTouchUpInside];
    [btnPayother setTitleColor:MainColor forState:UIControlStateNormal];
    [viewPayother addSubview:btnPayother];
    [btnPayother mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-5);
        make.centerY.mas_equalTo(viewPayother);
        make.size.mas_equalTo(CGSizeMake(80, 40));
    }];
    
    [viewPayother addSubview:self.textFieldPayOther];
    [self.textFieldPayOther mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(labelPayother.mas_right).offset(10);
        make.right.mas_equalTo(btnPayother.mas_left).offset(-10);
        make.height.top.mas_equalTo(viewPayother);
    }];
    
    //合计费用
    HLUnderlineView* viewPaytotal = [self createUnderlineView];
    [contentView addSubview:viewPaytotal];
    [viewPaytotal mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(viewPayother.mas_bottom);
        make.height.mas_equalTo(rowHeight);
        make.left.right.mas_equalTo(contentView);
    }];
    
    UILabel* labelPaytotal = [UILabel new];
    labelPaytotal.text = @"合计";
    [viewPaytotal addSubview:labelPaytotal];
    [labelPaytotal mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.centerY.mas_equalTo(viewPaytotal);
        make.width.mas_equalTo(40);
    }];
    
    [viewPaytotal addSubview:self.textFieldPayTotal];
    [self.textFieldPayTotal mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(labelPaytotal.mas_right).offset(10);
        make.right.mas_equalTo(-10);
        make.height.top.mas_equalTo(viewPaytotal);
    }];
    
    //代收和回扣
    HLUnderlineView* viewCollection = [self createUnderlineView];
    [contentView addSubview:viewCollection];
    [viewCollection mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(viewPaytotal.mas_bottom);
        make.height.mas_equalTo(rowHeight);
        make.left.right.mas_equalTo(contentView);
    }];
    
    UILabel* labelCollection = [UILabel new];
    labelCollection.text = @"代收";
    [viewCollection addSubview:labelCollection];
    [labelCollection mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.centerY.mas_equalTo(viewCollection);
        make.width.mas_equalTo(40);
    }];
    
    [viewCollection addSubview:self.textFieldCollection];
    [self.textFieldCollection mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.centerY.mas_equalTo(viewCollection);
        make.right.mas_equalTo(viewCollection.mas_centerX).offset(-5);
        make.left.mas_equalTo(labelCollection.mas_right).offset(5);
    }];
    
    UILabel* labelKickback = [UILabel new];
    labelKickback.text = @"回扣";
    [viewCollection addSubview:labelKickback];
    [labelKickback mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(viewCollection.mas_centerX).offset(5);
        make.centerY.mas_equalTo(viewCollection);
        make.width.mas_equalTo(40);
    }];
    
    [viewCollection addSubview:self.textFieldKickback];
    [self.textFieldKickback mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.centerY.mas_equalTo(viewCollection);
        make.right.mas_equalTo(-5);
        make.left.mas_equalTo(labelKickback.mas_right).offset(5);
    }];
    
    //保价
    HLUnderlineView* viewInsure = [self createUnderlineView];
    [contentView addSubview:viewInsure];
    [viewInsure mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(viewCollection.mas_bottom);
        make.height.mas_equalTo(rowHeight);
        make.left.right.mas_equalTo(contentView);
    }];
    
    [viewInsure addSubview:self.btnInsure];
    [self.btnInsure mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(viewInsure);
        make.height.mas_equalTo(30);
        make.right.mas_equalTo(-5);
        make.width.mas_equalTo(70);
    }];
    
    [viewInsure addSubview:self.viewNoValue];
    self.viewNoValue.hidden = NO;
    [self.viewNoValue mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.height.top.mas_equalTo(viewInsure);
        make.right.mas_equalTo(self.btnInsure.mas_left).offset(-5);
    }];
    
    UILabel* labelFreight1 = [UILabel new];
    labelFreight1.text = @"本次运输赔偿限额";
    [self.viewNoValue addSubview:labelFreight1];
    [labelFreight1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.centerY.mas_equalTo(self.viewNoValue);
    }];
    
    [self.viewNoValue addSubview:self.textFieldFreightMultiple];
    [self.textFieldFreightMultiple mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(labelFreight1.mas_right).offset(5);
        make.centerY.mas_equalTo(self.viewNoValue);
        make.size.mas_equalTo(40);
    }];
    
    UILabel* labelFreight2 = [UILabel new];
    labelFreight2.text = @"倍运费";
    [self.viewNoValue addSubview:labelFreight2];
    [labelFreight2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.textFieldFreightMultiple.mas_right).offset(5);
        make.centerY.mas_equalTo(self.viewNoValue);
    }];
    
    [viewInsure addSubview:self.viewValue];
    self.viewValue.hidden = YES;
    [self.viewValue mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.height.top.mas_equalTo(viewInsure);
        make.right.mas_equalTo(self.btnInsure.mas_left).offset(-5);
    }];
    
    UILabel* labelInsureCost = [UILabel new];
    labelInsureCost.text = @"保价费用";
    [self.viewValue addSubview:labelInsureCost];
    [labelInsureCost mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.centerY.mas_equalTo(self.viewValue);
        make.width.mas_equalTo(80);
    }];
    
    [self.viewValue addSubview:self.textFieldInsuredCost];
    [self.textFieldInsuredCost mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.centerY.mas_equalTo(self.viewValue);
        make.right.mas_equalTo(self.viewValue.mas_centerX).offset(-5);
        make.left.mas_equalTo(labelInsureCost.mas_right).offset(5);
    }];
    
    UILabel* labelInsureValue = [UILabel new];
    labelInsureValue.text = @"保价金额";
    [self.viewValue addSubview:labelInsureValue];
    [labelInsureValue mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.viewValue.mas_centerX).offset(5);
        make.centerY.mas_equalTo(self.viewValue);
        make.width.mas_equalTo(80);
    }];
    
    [self.viewValue addSubview:self.textFieldInsuredValue];
    [self.textFieldInsuredValue mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.centerY.mas_equalTo(self.viewValue);
        make.right.mas_equalTo(-5);
        make.left.mas_equalTo(labelInsureValue.mas_right).offset(5);
    }];
    
    //附加条约
    HLUnderlineView* viewSubjoin = [self createUnderlineView];
    [contentView addSubview:viewSubjoin];
    [viewSubjoin mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(viewInsure.mas_bottom);
        make.height.mas_equalTo(rowHeight+30);
        make.left.right.mas_equalTo(contentView);
    }];
    
    UILabel* label6 = [UILabel new];
    label6.text = @"附加条约";
    [viewSubjoin addSubview:label6];
    [label6 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.top.mas_equalTo(0);
        make.height.mas_equalTo(30);
    }];
    
    [viewSubjoin addSubview:self.btnMore];
    [self.btnMore mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(viewSubjoin.mas_top).offset(60);
        make.right.mas_equalTo(-5);
        make.size.mas_equalTo(CGSizeMake(30, 30));
    }];
    
    [viewSubjoin addSubview:self.textFieldSubjoin];
    [self.textFieldSubjoin mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.btnMore);
        make.height.mas_equalTo(40);
        make.left.mas_equalTo(5);
        make.right.mas_equalTo(self.btnMore.mas_left).offset(-10);
    }];
    
    UILabel* label7 = [UILabel new];
    label7.text = @"通知";
    [contentView addSubview:label7];
    [label7 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.top.mas_equalTo(viewSubjoin.mas_bottom);
        make.height.mas_equalTo(30);
    }];
    
    HLUnderlineView* viewNotifice = [self createUnderlineView];
    [contentView addSubview:viewNotifice];
    [viewNotifice mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(label7.mas_bottom);
        make.height.mas_equalTo(rowHeight);
        make.left.right.mas_equalTo(contentView);
    }];
    
    [viewNotifice addSubview:self.btnNotificeReceiver];
    [self.btnNotificeReceiver mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(viewNotifice);
        make.size.mas_equalTo(CGSizeMake(150, 30));
        make.left.mas_equalTo(5);
    }];
    
    [viewNotifice addSubview:self.btnNotificeSender];
    [self.btnNotificeSender mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(viewNotifice);
        make.size.mas_equalTo(self.btnNotificeReceiver);
        make.left.mas_equalTo(viewNotifice.mas_centerX);
    }];
    
    [contentView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(viewNotifice.mas_bottom);
    }];
    
    if (self.type == 1) {
        [self modelToView];
    } else {
        [self getWaybillDetail];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
}

- (void)getWaybillDetail {
    [SVProgressHUD showWithStatus:@"获取订单详情中..."];
    [HLWebManager getWaybillDetail:self.waybillId successBlock:^(id response) {
        if ([response[@"code"]integerValue]==1) {
            [SVProgressHUD dismiss];
            self.waybillObject = [HLWaybillDetailObject mj_objectWithKeyValues:response[@"info"]];
            [self modelToView];
        } else {
            [SVProgressHUD showErrorWithStatus:response[@"message"]];
        }
    } failureBlock:^(NSError *error) {
        [SVProgressHUD showSuccessWithStatus:@"未知错误"];
    }];
}

- (void)modelToView {
    self.labelRecvStation.text = self.waybillObject.destinationWebsite;
    if ([self.labelRecvStation.text isEqualToString:@"无网点"]) {
        self.btnRecvStation.enabled = NO;
        self.textFieldRecvStation.enabled = YES;
    } else {
        self.btnRecvStation.enabled = YES;
        self.textFieldRecvStation.enabled = NO;
    }
    self.textFieldWaybillNumber.text = self.waybillObject.waybillNumber;
    self.textFieldRecvName.text = self.waybillObject.consigneeName;
    self.textFieldRecvPhone.text = self.waybillObject.consigneeContactPhone;
    self.textFieldRecvAddress.text = self.waybillObject.deliveryAddress;
    self.textFieldSendName.text = self.waybillObject.consignorName ;
    self.textFieldSendPhone.text = self.waybillObject.consignorContactPhone;
    self.textFieldCargoName.text = self.waybillObject.cargoName;
    self.textFieldCargoCount.text = self.waybillObject.cargoCount;
    [self.btnPack setTitle:self.waybillObject.packing forState:UIControlStateNormal];
    [self.btnTransportType setTitle:self.waybillObject.transportType forState:UIControlStateNormal];
    [self.btnDeliverType setTitle:self.waybillObject.service forState:UIControlStateNormal];
    self.textFieldWeight.text = self.waybillObject.cargoWeight;
    self.textFieldVolume.text = self.waybillObject.cargoVolume;
    self.textFieldPayment.text = self.waybillObject.transportFees;
    [self.btnPayType setTitle:self.waybillObject.paymentWay forState:UIControlStateNormal];
    self.textFieldPayOther.text = self.waybillObject.othersFees ;
    self.textFieldPayTotal.text = self.waybillObject.totalFees ;
    self.textFieldCollection.text = self.waybillObject.collectionProcurationFees ;
    self.textFieldKickback.text = self.waybillObject.kickback ;                         //回扣
    self.textFieldFreightMultiple.text = self.waybillObject.indemnityLimit ;            //赔偿运费倍数
    self.textFieldInsuredCost.text = self.waybillObject.insuredFees ;                   //保价费用
    self.textFieldInsuredValue.text = self.waybillObject.insuredAmount ;                //保价金额
    self.textFieldSubjoin.text = self.waybillObject.additionalGuest ;                   //附加条约
    self.btnNotificeReceiver.checkState = [self.waybillObject.smsReceiverCreateWaybill integerValue]==1 ? M13CheckboxStateChecked : M13CheckboxStateUnchecked;
    self.btnNotificeSender.checkState = [self.waybillObject.smsConsignorCreateWaybill integerValue]==1 ? M13CheckboxStateChecked : M13CheckboxStateUnchecked ;
    
    [self.btnPack setTitle:self.waybillObject.packing forState:UIControlStateNormal];
    [self.btnDeliverType setTitle:self.waybillObject.serviceName forState:UIControlStateNormal];     //提货方式
    [self.btnTransportType setTitle:self.waybillObject.transportTypeName forState:UIControlStateNormal];
    [self.btnPayType setTitle:self.waybillObject.paymentWayName forState:UIControlStateNormal]; //付款方式
}

- (void)viewToModel {
    self.waybillObject.destinationLocation = self.textFieldRecvStation.text;
    self.waybillObject.waybillNumber = self.textFieldWaybillNumber.text;
    self.waybillObject.consigneeName = self.textFieldRecvName.text;
    self.waybillObject.consigneeContactPhone = self.textFieldRecvPhone.text;
    self.waybillObject.deliveryAddress = self.textFieldRecvAddress.text;
    self.waybillObject.consignorName = self.textFieldSendName.text;
    self.waybillObject.consignorContactPhone = self.textFieldSendPhone.text;
    self.waybillObject.cargoName = self.textFieldCargoName.text;
    self.waybillObject.cargoCount = self.textFieldCargoCount.text;
    self.waybillObject.cargoWeight = self.textFieldWeight.text;
    self.waybillObject.cargoVolume = self.textFieldVolume.text;
    self.waybillObject.transportFees = self.textFieldPayment.text;
    self.waybillObject.othersFees = self.textFieldPayOther.text;
    self.waybillObject.totalFees = self.textFieldPayTotal.text;
    self.waybillObject.collectionProcurationFees = self.textFieldCollection.text;
    self.waybillObject.kickback = self.textFieldKickback.text;                      //回扣
    self.waybillObject.indemnityLimit = self.textFieldFreightMultiple.text;         //赔偿运费倍数
    self.waybillObject.insuredFees = self.textFieldInsuredCost.text;                //保价费用
    self.waybillObject.insuredAmount = self.textFieldInsuredValue.text;             //保价金额
    self.waybillObject.additionalGuest = self.textFieldSubjoin.text;                //附加条约
    self.waybillObject.smsReceiverCreateWaybill = self.btnNotificeReceiver.checkState == M13CheckboxStateChecked ? @"1" : @"0";
    self.waybillObject.smsConsignorCreateWaybill = self.btnNotificeSender.checkState == M13CheckboxStateChecked ? @"1" : @"0";
    
    self.waybillObject.packing = self.btnPack.zlTextLabel.text;
    //self.waybillObject.transportType = self.btnDeliverType.zlTextLabel.text;
    //self.waybillObject.service = self.btnDeliverType.zlTextLabel.text;
    //self.waybillObject.paymentWay = self.btnPayType.zlTextLabel.text;
}

- (void)chooseContact:(ZLImageTextButton*)btn {
    ContactType type = btn.tag == 1000 ? receiver : sender;
    WeakSelf;
    HLContactListVC* vc = [[HLContactListVC alloc]initWithType:type];
    vc.onSelectContact = ^(id model) {
        if (type == sender) {
            HLConsignorObject* obj = (HLConsignorObject*)model;
            weakSelf.textFieldSendName.text = obj.consignorName;
            weakSelf.textFieldSendPhone.text = obj.consignorTel;
        } else {
            HLConsigneeObject* obj = (HLConsigneeObject*)model;
            weakSelf.textFieldRecvName.text = obj.consigneeName;
            weakSelf.textFieldRecvPhone.text = obj.consigneeTel;
        }
    };
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)onPickerView:(id)button {
    WeakSelf;
    [self.view endEditing:YES];
    if (button == self.btnPack) {
        NSMutableArray* array = [NSMutableArray new];
        for (HLPackingWayObject* obj in [HLSingleton share].packingWays) {
            [array addObject:obj.packing];
        }
        [ActionSheetStringPicker showPickerWithTitle:@"包装" rows:array initialSelection:0 doneBlock:^(ActionSheetStringPicker *picker, NSInteger selectedIndex, id selectedValue) {
            [weakSelf.btnPack setTitle:selectedValue forState:UIControlStateNormal];
            //HLPackingWayObject* obj = [[[HLSingleton share]getPackingWays] objectAtIndex:selectedIndex];
            weakSelf.waybillObject.packing = selectedValue;
        } cancelBlock:^(ActionSheetStringPicker *picker) {
            
        } origin:self.view];
    } else if (button == self.btnDeliverType) {
        NSMutableArray* array = [NSMutableArray new];
        for (HLServiceTypeObject* obj in [HLSingleton share].serviceTypes) {
            [array addObject:obj.serviceName];
        }
        [ActionSheetStringPicker showPickerWithTitle:@"送货" rows:array initialSelection:0 doneBlock:^(ActionSheetStringPicker *picker, NSInteger selectedIndex, id selectedValue) {
            [weakSelf.btnDeliverType setTitle:selectedValue forState:UIControlStateNormal];
            HLServiceTypeObject* obj = [[HLSingleton share].serviceTypes objectAtIndex:selectedIndex];
            weakSelf.waybillObject.service = obj.service;
        } cancelBlock:^(ActionSheetStringPicker *picker) {
            
        } origin:self.view];
    } else if (button == self.btnTransportType) {
        NSMutableArray* array = [NSMutableArray new];
        for (HLTransportTypeObject* obj in [HLSingleton share].transportTypes) {
            [array addObject:obj.transportTypeName];
        }
        [ActionSheetStringPicker showPickerWithTitle:@"运输类型" rows:array initialSelection:0 doneBlock:^(ActionSheetStringPicker *picker, NSInteger selectedIndex, id selectedValue) {
            [weakSelf.btnTransportType setTitle:selectedValue forState:UIControlStateNormal];
            HLTransportTypeObject* obj = [[HLSingleton share].transportTypes objectAtIndex:selectedIndex];
            weakSelf.waybillObject.transportType = obj.transportType;
        } cancelBlock:^(ActionSheetStringPicker *picker) {
            
        } origin:self.view];
    } else if (button == self.btnPayType) {
        NSMutableArray* array = [NSMutableArray new];
        for (HLPaymentWayObject* obj in [HLSingleton share].paymentWays) {
            [array addObject:obj.paymentWayName];
        }
        [ActionSheetStringPicker showPickerWithTitle:@"付款" rows:array initialSelection:0 doneBlock:^(ActionSheetStringPicker *picker, NSInteger selectedIndex, id selectedValue) {
            [weakSelf.btnPayType setTitle:selectedValue forState:UIControlStateNormal];
            HLPaymentWayObject* obj = [[HLSingleton share].paymentWays objectAtIndex:selectedIndex];
            weakSelf.waybillObject.paymentWay = obj.paymentWay;
        } cancelBlock:^(ActionSheetStringPicker *picker) {
            
        } origin:self.view];
    } else if (button == self.btnMore) {
        NSMutableArray* array = [NSMutableArray new];
        for (HLAdditionalObject* obj in [HLSingleton share].additionals) {
            [array addObject:obj.additionalGuest];
        }
        [ActionSheetStringPicker showPickerWithTitle:@"附加条约" rows:array initialSelection:0 doneBlock:^(ActionSheetStringPicker *picker, NSInteger selectedIndex, id selectedValue) {
            weakSelf.textFieldSubjoin.text = selectedValue;
            weakSelf.waybillObject.additionalGuest = selectedValue;
        } cancelBlock:^(ActionSheetStringPicker *picker) {
            
        } origin:self.view];
    } else if (button == self.btnRecvStation) {
        [ActionSheetStringPicker showPickerWithTitle:@"选择网点" rows:@[@"到站网点",@"途径网点"] initialSelection:0 doneBlock:^(ActionSheetStringPicker *picker, NSInteger selectedIndex, id selectedValue) {
            [weakSelf.btnRecvStation setTitle:selectedValue forState:UIControlStateNormal];
            if (selectedIndex == 1) {
                weakSelf.textFieldRecvStation.enabled = YES;
                [weakSelf.textFieldRecvStation becomeFirstResponder];
            } else {
                weakSelf.textFieldRecvStation.enabled = NO;
                weakSelf.textFieldRecvStation.text = @"";
            }
        } cancelBlock:^(ActionSheetStringPicker *picker) {
            
        } origin:self.view];
    }
}

- (void)onClickButton:(UIButton*)sender {
    switch (sender.tag) {
        case 0: {
            [SVProgressHUD showInfoWithStatus:@"等待更新"];
        }
            break;
        case 1: {
            [self viewToModel];
            if ([self.waybillObject.destinationWebsite isEqualToString:@"无网点"]
                || [self.waybillObject.destinationWebsiteId isEqualToString:@"-1"]) {
                if (self.waybillObject.destinationLocation.length < 1) {
                    [SVProgressHUD showErrorWithStatus:@"无网点时到站地址必填!"];
                    return;
                }
            }
            if (self.waybillObject.cargoName.length < 1) {
                [SVProgressHUD showErrorWithStatus:@"货物名称必填!"];
                return;
            }
            if (self.waybillObject.cargoCount.length < 1) {
                [SVProgressHUD showErrorWithStatus:@"货物件数必填!"];
                return;
            }
            if (self.waybillObject.packing.length < 1) {
                [SVProgressHUD showErrorWithStatus:@"货物包装必填!"];
                return;
            }
            if (self.waybillObject.consigneeName.length < 1) {
                [SVProgressHUD showErrorWithStatus:@"收货联系人必填!"];
                return;
            }
            if (self.waybillObject.consigneeContactPhone.length < 1) {
                [SVProgressHUD showErrorWithStatus:@"收货联系人电话必填!"];
                return;
            }
            if (self.waybillObject.service.length < 1) {
                [SVProgressHUD showErrorWithStatus:@"送货方式必填!"];
                return;
            }
            if (self.waybillObject.transportType.length < 1) {
                [SVProgressHUD showErrorWithStatus:@"运输类型必填!"];
                return;
            }
            if (self.waybillObject.transportFees.length < 1) {
                [SVProgressHUD showErrorWithStatus:@"运费必填!"];
                return;
            }
            if (self.waybillObject.totalFees.length < 1) {
                [SVProgressHUD showErrorWithStatus:@"总运费必填!"];
                return;
            }
            if (self.waybillObject.paymentWay.length < 1) {
                [SVProgressHUD showErrorWithStatus:@"付款方式必填!"];
                return;
            }
            if (self.type == 1) {
                [SVProgressHUD showWithStatus:@"开单中..."];
                [HLWebManager addWaybill:self.waybillObject successBlock:^(id response) {
                    [SVProgressHUD dismiss];
                    if ([response[@"code"]integerValue]==1) {
                        [SVProgressHUD showSuccessWithStatus:@"开单成功"];
                        [self.navigationController popViewControllerAnimated:YES];
                    } else {
                        [SVProgressHUD showErrorWithStatus:response[@"message"]];
                    }
                } failureBlock:^(NSError *error) {
                    [SVProgressHUD showErrorWithStatus:@"未知错误"];
                }];
            } else {
                [SVProgressHUD showWithStatus:@"订单修改中..."];
                [HLWebManager submitWaybill:self.waybillObject successBlock:^(id response) {
                    [SVProgressHUD dismiss];
                    if ([response[@"code"]integerValue]==1) {
                        [SVProgressHUD showSuccessWithStatus:@"订单修改成功!"];
                        [self.navigationController popViewControllerAnimated:YES];
                    } else {
                        [SVProgressHUD showErrorWithStatus:response[@"message"]];
                    }
                } failureBlock:^(NSError *error) {
                    [SVProgressHUD showErrorWithStatus:@"未知错误"];
                }];
            }
        }
            break;
        default:
            break;
    }
}

- (void)onOtherPay {
    HLOtherPayView* view = [[HLOtherPayView alloc]initWithWaybill:self.waybillObject];
    view.delegate = self;
    [self.view addSubview:view];
    [view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(self.view);
    }];
    [view show];
}

- (void)onSaveOtherPay:(HLWaybillDetailObject*)model {
    self.waybillObject = model;
    self.textFieldPayOther.text = self.waybillObject.othersFees;
    self.textFieldPayTotal.text = [NSString stringWithFormat:@"%.2f",[self.textFieldPayment.text floatValue]+[self.textFieldPayOther.text floatValue]];
}

- (void)onClickCancellation {
    UIAlertController* alertController = [UIAlertController alertControllerWithTitle:@"警告" message:@"确定作废此订单?" preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction* canAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
    UIAlertAction* okAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        [HLWebManager cancellationWaybill:self.waybillId successBlock:^(id response) {
            if ([response[@"code"]integerValue]==1) {
                [SVProgressHUD showSuccessWithStatus:@"运单作废成功"];
                if ([_delegate respondsToSelector:@selector(onScrapWaybillCompletion:)]) {
                    [_delegate onScrapWaybillCompletion:self.waybillObject];
                }
                [self.navigationController popViewControllerAnimated:YES];
            } else {
                [SVProgressHUD showErrorWithStatus:response[@"message"]];
            }
        } failureBlock:^(NSError *error) {
            [SVProgressHUD showErrorWithStatus:@"未知错误"];
        }];
    }];
    [alertController addAction:canAction];
    [alertController addAction:okAction];
    [self presentViewController:alertController animated:YES completion:nil];
}

- (void)onClickInsure:(M13Checkbox*)btn {
    if (btn.checkState == M13CheckboxStateUnchecked) {
        self.viewNoValue.hidden = NO;
        self.viewValue.hidden = YES;
    } else {
        self.viewNoValue.hidden = YES;
        self.viewValue.hidden = NO;
    }
}

- (void)onClickNotificeReceiver:(M13Checkbox*)btn {
    
}

- (void)onClickNotificeSender:(M13Checkbox*)btn  {
    
}

- (void)textFieldDidEndEditing:(UITextField *)textField {
    if (textField == self.textFieldPayment) {
        self.textFieldPayTotal.text = [NSString stringWithFormat:@"%.2f",[self.textFieldPayment.text floatValue]+[self.textFieldPayOther.text floatValue]];
    }
}

- (HLUnderlineView*)createUnderlineView {
    HLUnderlineView* view = [[HLUnderlineView alloc]initWithFrame:CGRectZero];
    view.backgroundColor = [UIColor whiteColor];
    return view;
}

- (ZLImageTextButton*)btnRecvStation {
    if (!_btnRecvStation) {
        _btnRecvStation = [ZLImageTextButton buttonWithType:UIButtonTypeCustom];
        [_btnRecvStation setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [_btnRecvStation setImage:[UIImage imageNamed:@"hl_arrow_down_orange"] forState:UIControlStateNormal];
        [_btnRecvStation setTitle:@"到站网点" forState:UIControlStateNormal];
        [_btnRecvStation addTarget:self action:@selector(onPickerView:) forControlEvents:UIControlEventTouchUpInside];
        _btnRecvStation.zlImageSize = CGSizeMake(17, 17);
        _btnRecvStation.zlTextLabel.font = [UIFont systemFontOfSize:16];
        _btnRecvStation.zlButtonType = ZLImageRightTextLeft;
    }
    return _btnRecvStation;
}

- (UILabel*)labelRecvStation {
    if (!_labelRecvStation) {
        _labelRecvStation = [UILabel new];
        _labelRecvStation.textAlignment = NSTextAlignmentCenter;
        _labelRecvStation.textColor = [UIColor orangeColor];
        _labelRecvStation.font = [UIFont systemFontOfSize:16];
    }
    return _labelRecvStation;
}

- (UITextField*)textFieldRecvStation {
    if (!_textFieldRecvStation) {
        _textFieldRecvStation = [UITextField new];
        _textFieldRecvStation.textColor = [UIColor orangeColor];
        _textFieldRecvStation.placeholder = @"无网点必须输入";
        _textFieldRecvStation.font = [UIFont systemFontOfSize:15];
        [_textFieldRecvStation setAutocorrectionType:UITextAutocorrectionTypeNo];
        [_textFieldRecvStation setAutocapitalizationType:UITextAutocapitalizationTypeNone];
    }
    return _textFieldRecvStation;
}

- (UITextField*)textFieldWaybillNumber {
    if (!_textFieldWaybillNumber) {
        _textFieldWaybillNumber = [UITextField new];
        _textFieldWaybillNumber.textColor = TextColor;
        _textFieldWaybillNumber.text = @"000000000000";
    }
    return _textFieldWaybillNumber;
}

- (UITextField*)textFieldRecvName {
    if (!_textFieldRecvName) {
        _textFieldRecvName = [[UITextField alloc]init];
        _textFieldRecvName.placeholder = @"收货人名字 *";
        [_textFieldRecvName setAutocorrectionType:UITextAutocorrectionTypeNo];
        [_textFieldRecvName setAutocapitalizationType:UITextAutocapitalizationTypeNone];
    }
    return _textFieldRecvName;
}

- (UITextField*)textFieldRecvPhone {
    if (!_textFieldRecvPhone) {
        _textFieldRecvPhone = [[UITextField alloc]init];
        _textFieldRecvPhone.placeholder = @"收货人电话 *";
        _textFieldRecvPhone.keyboardType = UIKeyboardTypeDecimalPad;
    }
    return _textFieldRecvPhone;
}

- (UITextField*)textFieldRecvAddress {
    if (!_textFieldRecvAddress) {
        _textFieldRecvAddress = [[UITextField alloc]init];
        _textFieldRecvAddress.placeholder = @"收货人地址";
        [_textFieldRecvAddress setAutocorrectionType:UITextAutocorrectionTypeNo];
        [_textFieldRecvAddress setAutocapitalizationType:UITextAutocapitalizationTypeNone];
    }
    return _textFieldRecvAddress;
}

- (UITextField*)textFieldSendName {
    if (!_textFieldSendName) {
        _textFieldSendName = [[UITextField alloc]init];
        _textFieldSendName.placeholder = @"托运人姓名";
        [_textFieldSendName setAutocorrectionType:UITextAutocorrectionTypeNo];
        [_textFieldSendName setAutocapitalizationType:UITextAutocapitalizationTypeNone];
    }
    return _textFieldSendName;
}

- (UITextField*)textFieldSendPhone {
    if (!_textFieldSendPhone) {
        _textFieldSendPhone = [[UITextField alloc]init];
        _textFieldSendPhone.placeholder = @"托运人电话";
        _textFieldSendPhone.keyboardType = UIKeyboardTypeDecimalPad;
    }
    return _textFieldSendPhone;
}

- (UITextField*)textFieldCargoName {
    if (!_textFieldCargoName) {
        _textFieldCargoName = [[UITextField alloc]init];
        _textFieldCargoName.placeholder = @"请填写货物名称 *";
        _textFieldCargoName.textAlignment = NSTextAlignmentRight;
        [_textFieldCargoName setAutocorrectionType:UITextAutocorrectionTypeNo];
        [_textFieldCargoName setAutocapitalizationType:UITextAutocapitalizationTypeNone];
    }
    return _textFieldCargoName;
}

- (UITextField*)textFieldCargoCount {
    if (!_textFieldCargoCount) {
        _textFieldCargoCount = [[UITextField alloc]init];
        _textFieldCargoCount.placeholder = @"0";
        _textFieldCargoCount.textAlignment = NSTextAlignmentCenter;
        UILabel* label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 20, 20)];
        label.textColor = TextColor;
        label.text = @"件";
        _textFieldCargoCount.rightView = label;
        _textFieldCargoCount.rightViewMode = UITextFieldViewModeAlways;
        _textFieldCargoCount.keyboardType = UIKeyboardTypeDecimalPad;
    }
    return _textFieldCargoCount;
}

- (ZLImageTextButton*)btnPack {
    if (!_btnPack) {
        _btnPack = [[ZLImageTextButton alloc]initWithFrame:CGRectZero];
        [_btnPack setImage:[UIImage imageNamed:@"hl_arrow_down_orange"] forState:UIControlStateNormal];
        [_btnPack setTitle:@"无" forState:UIControlStateNormal];
        _btnPack.zlButtonType = ZLImageRightTextLeft;
        [_btnPack addTarget:self action:@selector(onPickerView:) forControlEvents:UIControlEventTouchUpInside];
        _btnPack.zlTextLabel.font = [UIFont systemFontOfSize:17];
        _btnPack.zlImageSize = CGSizeMake(17, 17);
    }
    return _btnPack;
}

- (ZLImageTextButton*)btnDeliverType {
    if (!_btnDeliverType) {
        _btnDeliverType = [[ZLImageTextButton alloc]initWithFrame:CGRectZero];
        [_btnDeliverType setImage:[UIImage imageNamed:@"hl_arrow_down_orange"] forState:UIControlStateNormal];
        [_btnDeliverType setTitle:@"自提自装" forState:UIControlStateNormal];
        [_btnDeliverType addTarget:self action:@selector(onPickerView:) forControlEvents:UIControlEventTouchUpInside];
        _btnDeliverType.zlButtonType = ZLImageRightTextLeft;
        _btnDeliverType.zlImageSize = CGSizeMake(17, 17);
        _btnDeliverType.zlTextLabel.font = [UIFont systemFontOfSize:17];
    }
    return _btnDeliverType;
}

- (ZLImageTextButton*)btnTransportType {
    if (!_btnTransportType) {
        _btnTransportType = [[ZLImageTextButton alloc]initWithFrame:CGRectZero];
        [_btnTransportType setImage:[UIImage imageNamed:@"hl_arrow_down_orange"] forState:UIControlStateNormal];
        [_btnTransportType setTitle:@"零担" forState:UIControlStateNormal];
        [_btnTransportType addTarget:self action:@selector(onPickerView:) forControlEvents:UIControlEventTouchUpInside];
        _btnTransportType.zlButtonType = ZLImageRightTextLeft;
        _btnTransportType.zlImageSize = CGSizeMake(17, 17);
        _btnTransportType.zlTextLabel.font = [UIFont systemFontOfSize:17];
    }
    return _btnTransportType;
}

- (UITextField*)textFieldWeight {
    if (!_textFieldWeight) {
        _textFieldWeight = [[UITextField alloc]init];
        _textFieldWeight.placeholder = @"0.0";
        _textFieldWeight.textAlignment = NSTextAlignmentCenter;
        _textFieldWeight.textColor = MainColor;
        UILabel* label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 40, 20)];
        label.textColor = XMColor(150, 150, 150);
        label.text = @"公斤";
        _textFieldWeight.rightView = label;
        _textFieldWeight.rightViewMode = UITextFieldViewModeAlways;
        _textFieldWeight.keyboardType = UIKeyboardTypeDecimalPad;
    }
    return _textFieldWeight;
}

- (UITextField*)textFieldVolume {
    if (!_textFieldVolume) {
        _textFieldVolume = [[UITextField alloc]init];
        _textFieldVolume.placeholder = @"0.0";
        _textFieldVolume.textColor = MainColor;
        _textFieldVolume.textAlignment = NSTextAlignmentCenter;
        UILabel* label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 40, 20)];
        label.textColor = XMColor(150, 150, 150);
        label.text = @"立方";
        _textFieldVolume.rightView = label;
        _textFieldVolume.rightViewMode = UITextFieldViewModeAlways;
        _textFieldVolume.keyboardType = UIKeyboardTypeDecimalPad;
    }
    return _textFieldVolume;
}

- (UITextField*)textFieldPayment {
    if (!_textFieldPayment) {
        _textFieldPayment = [[UITextField alloc]init];
        _textFieldPayment.placeholder = @"0.0";
        _textFieldPayment.textAlignment = NSTextAlignmentCenter;
        UILabel* label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 40, 20)];
        label.textColor = XMColor(150, 150, 150);
        label.text = @"元";
        _textFieldPayment.delegate = self;
        _textFieldPayment.rightView = label;
        _textFieldPayment.rightViewMode = UITextFieldViewModeAlways;
        _textFieldPayment.keyboardType = UIKeyboardTypeDecimalPad;
    }
    return _textFieldPayment;
}

- (ZLImageTextButton*)btnPayType {
    if (!_btnPayType) {
        _btnPayType = [[ZLImageTextButton alloc]initWithFrame:CGRectZero];
        [_btnPayType setImage:[UIImage imageNamed:@"hl_arrow_down_blue"] forState:UIControlStateNormal];
        [_btnPayType setTitle:@"提付" forState:UIControlStateNormal];
        _btnPayType.zlButtonType = ZLImageRightTextLeft;
        _btnPayType.zlImageSize = CGSizeMake(17, 17);
        [_btnPayType addTarget:self action:@selector(onPickerView:) forControlEvents:UIControlEventTouchUpInside];
        _btnPayType.zlTextLabel.font = [UIFont systemFontOfSize:17];
    }
    return _btnPayType;
}

- (UITextField*)textFieldPayOther {
    if (!_textFieldPayOther) {
        _textFieldPayOther = [[UITextField alloc]init];
        _textFieldPayOther.text = @"0.0";
        _textFieldPayOther.textColor = MainColor;
        _textFieldPayOther.enabled = NO;
        _textFieldPayOther.textAlignment = NSTextAlignmentRight;
        UILabel* label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 40, 20)];
        label.textColor = XMColor(150, 150, 150);
        label.text = @"元";
        _textFieldPayOther.rightView = label;
        _textFieldPayOther.rightViewMode = UITextFieldViewModeAlways;
        _textFieldPayOther.keyboardType = UIKeyboardTypeDecimalPad;
    }
    return _textFieldPayOther;
}

- (UITextField*)textFieldPayTotal {
    if (!_textFieldPayTotal) {
        _textFieldPayTotal = [[UITextField alloc]init];
        _textFieldPayTotal.text = @"0.0";
        _textFieldPayTotal.textColor = MainColor;
        _textFieldPayTotal.enabled = NO;
        _textFieldPayTotal.textAlignment = NSTextAlignmentRight;
        UILabel* label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 40, 20)];
        label.textColor = XMColor(150, 150, 150);
        label.text = @"元";
        _textFieldPayTotal.rightView = label;
        _textFieldPayTotal.rightViewMode = UITextFieldViewModeAlways;
        _textFieldPayTotal.keyboardType = UIKeyboardTypeDecimalPad;
    }
    return _textFieldPayTotal;
}

- (UITextField*)textFieldCollection {
    if (!_textFieldCollection) {
        _textFieldCollection = [[UITextField alloc]init];
        _textFieldCollection.placeholder = @"0.0";
        _textFieldCollection.textColor = MainColor;
        _textFieldCollection.textAlignment = NSTextAlignmentCenter;
        UILabel* label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 40, 20)];
        label.textColor = XMColor(150, 150, 150);
        label.text = @"元";
        _textFieldCollection.rightView = label;
        _textFieldCollection.rightViewMode = UITextFieldViewModeAlways;
        _textFieldCollection.keyboardType = UIKeyboardTypeDecimalPad;
    }
    return _textFieldCollection;
}

- (UITextField*)textFieldKickback {
    if (!_textFieldKickback) {
        _textFieldKickback = [[UITextField alloc]init];
        _textFieldKickback.placeholder = @"0.0";
        _textFieldKickback.textColor = MainColor;
        _textFieldKickback.textAlignment = NSTextAlignmentCenter;
        UILabel* label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 40, 20)];
        label.textColor = XMColor(150, 150, 150);
        label.text = @"元";
        _textFieldKickback.rightView = label;
        _textFieldKickback.rightViewMode = UITextFieldViewModeAlways;
        _textFieldKickback.keyboardType = UIKeyboardTypeDecimalPad;
    }
    return _textFieldKickback;
}

- (HLUnderlineView*)viewValue {
    if (!_viewValue) {
        _viewValue = [self createUnderlineView];
    }
    return _viewValue;
}

- (HLUnderlineView*)viewNoValue {
    if (!_viewNoValue) {
        _viewNoValue = [self createUnderlineView];
    }
    return _viewNoValue;
}

- (M13Checkbox*)btnInsure {
    if (!_btnInsure) {
        _btnInsure = [[M13Checkbox alloc]initWithTitle:@"保价"];
        _btnInsure.checkState = M13CheckboxStateUnchecked;
        _btnInsure.checkColor = MainColor;
        _btnInsure.strokeColor = [UIColor blackColor];
        _btnInsure.checkAlignment = M13CheckboxAlignmentLeft;
        [_btnInsure addTarget:self action:@selector(onClickInsure:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _btnInsure;
}

- (UITextField*)textFieldFreightMultiple {
    if (!_textFieldFreightMultiple) {
        _textFieldFreightMultiple = [[UITextField alloc]init];
        _textFieldFreightMultiple.textAlignment = NSTextAlignmentCenter;
        _textFieldFreightMultiple.textColor = [UIColor redColor];
        _textFieldFreightMultiple.layer.borderWidth = 1;
        _textFieldFreightMultiple.layer.borderColor = [UIColor blackColor].CGColor;
        [_textFieldFreightMultiple setAutocorrectionType:UITextAutocorrectionTypeNo];
        [_textFieldFreightMultiple setAutocapitalizationType:UITextAutocapitalizationTypeNone];
    }
    return _textFieldFreightMultiple;
}

- (UITextField*)textFieldInsuredCost {
    if (!_textFieldInsuredCost) {
        _textFieldInsuredCost = [[UITextField alloc]init];
        _textFieldInsuredCost.placeholder = @"0.0";
        _textFieldInsuredCost.textColor = MainColor;
        _textFieldInsuredCost.textAlignment = NSTextAlignmentCenter;
        UILabel* label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 40, 20)];
        label.textColor = XMColor(150, 150, 150);
        label.text = @"元";
        _textFieldInsuredCost.rightView = label;
        _textFieldInsuredCost.rightViewMode = UITextFieldViewModeAlways;
        _textFieldInsuredCost.keyboardType = UIKeyboardTypeDecimalPad;
    }
    return _textFieldInsuredCost;
}

- (UITextField*)textFieldInsuredValue {
    if (!_textFieldInsuredValue) {
        _textFieldInsuredValue = [[UITextField alloc]init];
        _textFieldInsuredValue.placeholder = @"0.0";
        _textFieldInsuredValue.textColor = MainColor;
        _textFieldInsuredValue.textAlignment = NSTextAlignmentCenter;
        UILabel* label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 40, 20)];
        label.textColor = XMColor(150, 150, 150);
        label.text = @"元";
        _textFieldInsuredValue.rightView = label;
        _textFieldInsuredValue.rightViewMode = UITextFieldViewModeAlways;
        _textFieldInsuredValue.keyboardType = UIKeyboardTypeDecimalPad;
    }
    return _textFieldInsuredValue;
}

- (UITextField*)textFieldSubjoin {
    if (!_textFieldSubjoin) {
        _textFieldSubjoin = [[UITextField alloc]init];
        _textFieldSubjoin.backgroundColor = XMColor(230, 230, 230);
        [_textFieldSubjoin setAutocorrectionType:UITextAutocorrectionTypeNo];
        [_textFieldSubjoin setAutocapitalizationType:UITextAutocapitalizationTypeNone];
    }
    return _textFieldSubjoin;
}

- (UIButton*) btnMore {
    if (!_btnMore) {
        _btnMore = [UIButton buttonWithType:UIButtonTypeCustom];
        _btnMore.backgroundColor = MainColor;
        [_btnMore setTitle:@"..." forState:UIControlStateNormal];
        [_btnMore setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [_btnMore addTarget:self action:@selector(onPickerView:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _btnMore;
}

- (M13Checkbox*)btnNotificeReceiver {
    if (!_btnNotificeReceiver) {
        _btnNotificeReceiver = [[M13Checkbox alloc]initWithTitle:@"通知收货人"];
        _btnNotificeReceiver.checkState = M13CheckboxStateUnchecked;
        _btnNotificeReceiver.checkColor = MainColor;
        _btnNotificeReceiver.strokeColor = [UIColor blackColor];
        _btnNotificeReceiver.checkAlignment = M13CheckboxAlignmentLeft;
        [_btnNotificeReceiver addTarget:self action:@selector(onClickNotificeReceiver:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _btnNotificeReceiver;
}

- (M13Checkbox*)btnNotificeSender {
    if (!_btnNotificeSender) {
        _btnNotificeSender = [[M13Checkbox alloc]initWithTitle:@"通知托运人"];
        _btnNotificeSender.checkState = M13CheckboxStateUnchecked;
        _btnNotificeSender.checkColor = MainColor;
        _btnNotificeSender.strokeColor = [UIColor blackColor];
        _btnNotificeSender.checkAlignment = M13CheckboxAlignmentLeft;
        [_btnNotificeSender addTarget:self action:@selector(onClickNotificeSender:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _btnNotificeSender;
}


@end
